package tests;

import static org.junit.Assert.*;
/**
 * classe che fai il test sul login della pagina
 */

import java.util.ArrayList;

import mainService.ServiceParams;
import mainService.services.HttpFileServer;

import mainService.services.LoginService;

import org.junit.Before;
import org.junit.Test;

public class TestLogin {

	LoginService login;
	HttpFileServer http;
	ServiceParams params;

	@Before
	public void setUp() throws Exception {
		login = new LoginService();
		http = new HttpFileServer();
		params = new ServiceParams("");
	}

	@Test
	public void testGetServiceResult() {

		params.addParam("file", "home.html");
		ArrayList<String> giusto = http.getServiceResult(params);
		for (String string : giusto) {
			System.out.println(string);
		}
		ServiceParams params2 = new ServiceParams("username=Giuseppe&password=123");

		ArrayList<String> risultati = login.getServiceResult(params2);

		for (String string : risultati) {
			System.out.println(string);
		}
		assertEquals(giusto, risultati);
	}

}
